﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Detail.aspx.cs" Inherits="Workflow.GetNum.Detail" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <link rel="stylesheet" type="text/css" href="../Css/bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="../Css/bootstrap-responsive.css" />
    <link rel="stylesheet" type="text/css" href="../Css/style.css" />
    <script type="text/javascript" src="../Js/jquery.js"></script>
    <script type="text/javascript" src="../Js/jquery.sorted.js"></script>
    <script type="text/javascript" src="../Js/bootstrap.js"></script>
    <script type="text/javascript" src="../Js/ckform.js"></script>
    <script type="text/javascript" src="../Js/common.js"></script>

    <style type="text/css">
        body {
            padding-bottom: 40px;
        }
        .sidebar-nav {
            padding: 9px 0;
        }

        @media (max-width: 980px) {
            /* Enable use of floated navbar text */
            .navbar-text.pull-right {
                float: none;
                padding-left: 5px;
                padding-right: 5px;
            }
        }


    </style>
    
</head>
<body>
    <form id="form1" runat="server">
     <div>
       <table class="table table-bordered table-hover definewidth m10">
           <tr>
                <td class="tableleft">业务</td>
                <td><asp:DropDownList ID="ddlBusiness" runat="server">
                    <asp:ListItem></asp:ListItem>
                    <asp:ListItem>塑模</asp:ListItem>
                    <asp:ListItem>冲模</asp:ListItem>
                    <asp:ListItem>夹制具</asp:ListItem>
                    <asp:ListItem>零部件试制</asp:ListItem>
                    <asp:ListItem>零部件生产</asp:ListItem>
                    <asp:ListItem>外部零件</asp:ListItem>
                    <asp:ListItem>内部零件</asp:ListItem>
                    <asp:ListItem>制模零件</asp:ListItem>
                    </asp:DropDownList></td>
            </tr>
            <tr>
                <td class="tableleft">专案号</td>
                <td><asp:TextBox ID="txtZNum" runat="server" ReadOnly="true"></asp:TextBox></td>
            </tr>
            <tr id="trMold" style="display:none" runat="server">
                <td class="tableleft">Sap模具号</td>
                <td><asp:TextBox ID="txtMold" runat="server"></asp:TextBox></td>
            </tr>
            <tr id="trProject" style="display:none" runat="server">
                <td class="tableleft">Sap项目号</td>
                <td><asp:TextBox ID="txtProject" runat="server"></asp:TextBox></td>
            </tr>
            <tr id="trOrderNo" style="display:none" runat="server">
                <td class="tableleft">客户订单号</td>
                <td><asp:TextBox ID="txtOrderNo" runat="server"></asp:TextBox></td>
            </tr>
            <tr id="trCost" style="display:none" runat="server">
                <td class="tableleft">成本中心</td>
                <td><asp:DropDownList ID="ddlCost" runat="server">
                    <asp:ListItem></asp:ListItem>
                    <asp:ListItem>1</asp:ListItem>
                    <asp:ListItem>2</asp:ListItem>
                    <asp:ListItem>3</asp:ListItem>
                    </asp:DropDownList></td>
            </tr>
            <tr>
                <td class="tableleft"></td>
                <td>
                    <asp:Button ID="BtnSubmit" CssClass="btn btn-primary" runat="server" Text="提交" OnClientClick="return Validate()" OnClick="BtnSubmit_Click"/>
                </td>
            </tr>
        </table>
    </div>
    </form>
    <script type="text/javascript">
        $(document).ready(function () {
            ShowRule();
        });
        $("#ddlBusiness").change(function () {
            ShowRule();
            ClearData();
        });

        function ShowRule() {
            if ($("#ddlBusiness").val() == '') {
                $("#trMold").hide();
                $("#trProject").hide();
                $("#trOrderNo").hide();
                $("#trCost").hide();

            }
            else if ($("#ddlBusiness").val() == '塑模') {
                $("#trMold").show();
                $("#txtMold").attr("readonly", "readonly");
                $("#trProject").show();
                $("#trOrderNo").show();
                $("#trCost").hide();
            }
            else if ($("#ddlBusiness").val() == '冲模') {
                $("#trMold").show();
                $("#txtMold").attr("readonly", "readonly");
                $("#trProject").show();
                $("#trOrderNo").show();
                $("#trCost").hide();
            }
            else if ($("#ddlBusiness").val() == '夹制具') {
                $("#trMold").show();
                $("#txtMold").removeAttr("readonly");
                $("#trProject").show();
                $("#trOrderNo").show();
                $("#trCost").hide();
            }
            else if ($("#ddlBusiness").val() == '零部件试制') {
                $("#trMold").hide();
                $("#trProject").show();
                $("#trOrderNo").show();
                $("#trCost").hide();
            }
            else if ($("#ddlBusiness").val() == '零部件生产') {
                $("#trMold").hide();
                $("#trProject").hide();
                $("#trOrderNo").show();
                $("#trCost").hide();
            }
            else if ($("#ddlBusiness").val() == '外部零件') {
                $("#trMold").hide();
                $("#trProject").hide();
                $("#trOrderNo").show();
                $("#trCost").hide();
            }
            else if ($("#ddlBusiness").val() == '内部零件') {
                $("#trMold").hide();
                $("#trProject").hide();
                $("#trOrderNo").hide();
                $("#trCost").show();
            }
            else if ($("#ddlBusiness").val() == '制模零件') {
                $("#trMold").hide();
                $("#trProject").hide();
                $("#trOrderNo").hide();
                $("#trCost").show();
            }
        }

        function Validate() {
            if ($("#ddlBusiness").val() == '') {
                alert("请选择业务");
                return false;
            }
            else if ($("#ddlBusiness").val() == '塑模') {
                if ($("#txtProject").val() == '') {
                    alert("请填Sap项目号");
                    return false;
                }
                else if ($("#txtOrderNo").val() == '') {
                    alert("请填写客户订单号");
                    return false;
                }
            }
            else if ($("#ddlBusiness").val() == '冲模') {
                if ($("#txtProject").val() == '') {
                    alert("请填Sap项目号");
                    return false;
                }
                else if ($("#txtOrderNo").val() == '') {
                    alert("请填写客户订单号");
                    return false;
                }
            }
            else if ($("#ddlBusiness").val() == '夹制具') {
                if ($("#txtMold").val() == '') {
                    alert("请填Sap模具号");
                    return false;
                }
                else if ($("#txtProject").val() == '') {
                    alert("请填Sap项目号");
                    return false;
                }
                else if ($("#txtOrderNo").val() == '') {
                    alert("请填写客户订单号");
                    return false;
                }
            }
            else if ($("#ddlBusiness").val() == '零部件试制') {
                if ($("#txtOrderNo").val() == '') {
                    alert("请填Sap项目号");
                    return false;
                }
                else if ($("#txtOrderNo").val() == '') {
                    alert("请填写客户订单号");
                    return false;
                }
            }
            else if ($("#ddlBusiness").val() == '零部件生产') {
                if ($("#txtOrderNo").val() == '') {
                    alert("请填写客户订单号");
                    return false;
                }
            }
            else if ($("#ddlBusiness").val() == '外部零件') {
                if ($("#txtOrderNo").val() == '') {
                    alert("请填写客户订单号");
                    return false;
                }
            }
            else if ($("#ddlBusiness").val() == '内部零件') {
                if ($("#ddlCost").val() == '') {
                    alert("请填写成本中心");
                    return false;
                }
            }
            else if ($("#ddlBusiness").val() == '制模零件') {
                if ($("#ddlCost").val() == '') {
                    alert("请填写成本中心");
                    return false;
                }
            }
        }

        function ClearData() {
            $("#txtZNum").val("");
            $("#txtMold").val("");
            $("#txtProject").val("");
            $("#txtOrderNo").val("");
            $("#ddlCost").val("");
        }
    </script>
</body>
</html>

